<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
 

  <h:head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Secured File Manager</title>

    <h:outputScript library="javascript" name="explorer.js" target="head"/>

    <h:outputStylesheet library="css" name="style.css" />

  </h:head>

  <h:body>

    <div id="blueBar" >
      <div id="globalContainer">
        <div id="globalHeader">
          
          <!-- GLOBAL SEARCH -->
          <c:if test="#{featureController.globalSearchActivated}">
            <c:if test="#{applicationController.userConnected}">
		          <h:form id="searchForm" action="#" method="get" >
		            <div class="globalHeaderSearch" >
		              <input class="globalHeaderInput" type="text" name="searchRequest" size="30" />
		              <div class="globalHeaderSearchButtonContainer">
		                <h:commandButton class="globalHeaderSearchButton" value=" " />
		              </div>
		            </div>
		          </h:form>
            </c:if>
          </c:if>
        
          <!-- USER AUTHENTICATION -->
          <c:if test="#{featureController.userAuthenticationActivated}">
            <div class="globalHeaderAuthentication">
		          <!-- When the user is not connected -->
		          <!-- Then the authentication form is displayed -->
		          <h:form id="authenticationForm" action="#" method="post" rendered="#{!applicationController.userConnected}">
	              <h:outputLabel class="globalHeaderInputLabel" value="Login"/>
	              <h:inputText class="globalHeaderInput" type="text" value="#{applicationController.username}"/>
	              <h:outputLabel class="globalHeaderInputLabel" value="Password"/>
	              <h:inputSecret class="globalHeaderInput" value="#{applicationController.password}"/>
	              <div class="globalHeaderConnectionButtonContainer">
	                <h:commandButton class="globalHeaderConnectionButton" value="Connect" action="#{applicationController.connectUser}" />
	              </div>
		          </h:form>

		          <!-- Else the user identity and the logout button are displayed  -->
              <h:form rendered="#{applicationController.userConnected}">
                <div class="globalHeaderConnectionButtonContainer">
                  <h:commandButton class="globalHeaderConnectionButton" value="Disconnect" action="#{applicationController.disconnectUser}" />
                </div>
              </h:form>
            </div>
	        </c:if>

        </div>

        <div id="globalContent">
            <h:form id="resourcesForm">
          <div id="resourcesContainer">
            <div id="resourcesHeader">
              <span id="resourcesTitle">Resources administration</span>
            </div>
            <div id="resourcesContent">
                <h:dataTable width="100%" value="#{manageResourcesController.resources}" var="item" >
                  <!-- Select -->
									<h:column>
									  <f:facet name="header">
									    <h:outputText value="" />
									  </f:facet>
									  <h:selectBooleanCheckbox value="true" />
									</h:column>
                  <!-- Name -->
                  <h:column>
                    <f:facet name="header">
                      <h:outputLabel value="Name" />
                    </f:facet>
                    <h:outputText value="#{item.name}"/>
                  </h:column>
                  <!-- Type -->
                  <h:column>
                    <f:facet name="header">
                      <h:outputLabel value="Type" />
                    </f:facet>
                    <h:outputText value="#{item.type}"/>
                  </h:column>
                  <!-- Size -->
                  <h:column>
                    <f:facet name="header">
                      <h:outputLabel value="Size" />
                    </f:facet>
                    <h:outputText value="#{item.formattedSize}" rendered="#{item.isFile}"/>
                  </h:column>
                  <!-- Modification date -->
                  <h:column>
                    <f:facet name="header">
                      <h:outputLabel value="Modification date" />
                    </f:facet>
                    <h:outputText value="#{item.formattedModificationDate}" />
                  </h:column>
                  <!-- Description -->
                  <h:column>
                    <f:facet name="header">
                      <h:outputLabel value="Description" />
                    </f:facet>
                   <h:outputText value="" />
                 </h:column>
               </h:dataTable>
              </div>
          </div>
            </h:form>
        </div>
        <div id="globalFooter">
          <span id="globalFooterGenerationMetadata">Generated in 0.135s</span>
        </div>
      </div>
    </div>
  </h:body>

</html>